package com.kk.base.config.home;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.kk.base.constant.RuntimeConstant;
import com.kk.base.interceptor.home.HomeGlobalInterceptor;
import com.kk.base.interceptor.home.HomeLoginInterceptor;

/**
 * 配置前台拦截器
 */
@Configuration
public class HomeWebConfig implements WebMvcConfigurer {

    @Autowired
    private HomeLoginInterceptor homeLoginInterceptor;

    @Autowired
    private HomeGlobalInterceptor homeGlobalInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(homeLoginInterceptor).addPathPatterns("/**")
				.excludePathPatterns(RuntimeConstant.homeLoginExcludePathPatterns);
        registry.addInterceptor(homeGlobalInterceptor).addPathPatterns("/**")
				.excludePathPatterns(RuntimeConstant.homeGlobalExcludePathPatterns);
    }

}
